<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>JSP - Hello World</title>
</head>
<body>
<br/>

<script>
    function login(){
        document.getElementById("form0").action = "login";
        document.forms['form0'].submit();
    }

    function register(){
        document.getElementById("form0").action = "register";
        document.forms['form0'].submit();
    }
</script>

<form id="form0" action="" method="POST">
    username <input type="text" name="username"><br>
    password <input type="password" name="password"><br>
    <button onclick="login()">login</button>
    <button onclick="register()">register</button>
</form>
</body>
</html>